Ruff Check for all py files - #116
Conversation
|
@bhaveshAswani112 please check why CI is failing |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll help you investigate the CI failure. Let me check the workflow runs and examine the Ruff configuration. 🏁 Script executed: Length of output: 3082 Let me fix the commands and get more details about the CI failure: 🏁 Script executed: Length of output: 1574 Now I can see the issue! Let me examine the workflow file and get the detailed failure logs: 🏁 Script executed: Length of output: 20534 @NiveditJain I found the issue! The CI is failing because of a problem with how the GitHub Actions workflow handles multiple changed Python files. The Problem: Root Cause: echo "files=$FILES" >> "$GITHUB_OUTPUT"But GitHub Actions requires special formatting for multiline outputs. The current approach fails when The Fix: - name: Get changed Python files
id: changed-files
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE_SHA=${{ github.event.pull_request.base.sha }}
HEAD_SHA=${{ github.sha }}
else
BASE_SHA=${{ github.event.before }}
HEAD_SHA=${{ github.event.after }}
fi
# List all changed .py files
FILES=$(git diff --name-only --diff-filter=ACMRT $BASE_SHA $HEAD_SHA \
| grep -E '\.py$' || true)
# Handle multiline output properly for GitHub Actions
if [[ -n "$FILES" ]]; then
echo "files<<EOF" >> "$GITHUB_OUTPUT"
echo "$FILES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
else
echo "files=" >> "$GITHUB_OUTPUT"
fiAnd update the ruff command step to handle the files properly: - name: Run Ruff on changed files
if: steps.changed-files.outputs.files != ''
run: |
pip install ruff
echo "Linting the following Python files:"
echo "${{ steps.changed-files.outputs.files }}"
# Convert newline-separated files to space-separated for ruff
files="${{ steps.changed-files.outputs.files }}"
ruff check $filesThis fix uses GitHub Actions' heredoc syntax ( |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 162 🏁 Script executed: Length of output: 1088 @NiveditJain The CI is failing because the Ruff linter found 2 violations in Python files that weren't previously checked: Issues found:
Quick fix: ruff check . --fixSince the workflow now scans all |
|
Hey @NiveditJain , sorry for the confusion, and thank you for merging the PR! |
This workflow now checks all changed .py files across the entire repository, instead of limiting the scan to only api-server/ and state-manager/ directories.
This update addresses issue #71.